﻿using System.Data;

namespace DAL
{
    public static class DalAssignedAccountLevel2
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable AssignedAccountLevel2Get(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_tb_AssignedAccountLevel2_Get");
        }
        public static DataTable AssignedAccountLevel2GetEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel2", id);
            return Cls.GetData("sp_tb_AssignedAccountLevel2_Get_Edit");
        }
        public static DataTable AssignedAccountLevel2GetFillter(string idAccountLevel1, string incomeExpenditureMethodId)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel1", idAccountLevel1);
            Cls.AddParameter("@Income_Expenditure_Method_ID", incomeExpenditureMethodId);
            return Cls.GetData("sp_tb_AssignedAccountLevel2_Fillter");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtAssignedAccountLevel2 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel1", obj.IDAccountLevel1);
            Cls.AddParameter("@AccountLevel2_Name_Code", obj.AccountLevel2_Name_Code);
            Cls.AddParameter("@AccountLevel2_Name", obj.AccountLevel2_Name);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_tb_AssignedAccountLevel2_Get_Insert");
        }
        public static bool Update(EtAssignedAccountLevel2 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel2", obj.IDAccountLevel2);
            Cls.AddParameter("@IDAccountLevel1", obj.IDAccountLevel1);
            Cls.AddParameter("@AccountLevel2_Name_Code", obj.AccountLevel2_Name_Code);
            Cls.AddParameter("@AccountLevel2_Name", obj.AccountLevel2_Name);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_tb_AssignedAccountLevel2_Get_Update");
        }
        public static bool Delete(EtAssignedAccountLevel2 obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@IDAccountLevel2", obj.IDAccountLevel2);
            return Cls.ExecuteNonQuery("sp_tb_AssignedAccountLevel2_Get_Del");
        }
        #endregion
    }
    public class EtAssignedAccountLevel2
    {
        public int IDAccountLevel2 { get; set; }
        public int IDAccountLevel1 { get; set; }
        public string AccountLevel2_Name_Code { get; set; }
        public string AccountLevel2_Name { get; set; }
        public string Note { get; set; }
        public int Msg { get; set; }
    }
}
